<%@page contentType="text/html" %>
<%@page pageEncoding="UTF-8"%>

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>

<jsp:useBean id="servicePlan" class="java.util.List<entity.ServicePlan>" scope="request"/>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Upate Service Plan</title>
    </head>
    <body>
        <form name="formUpdateServicePlan" id="formUpdateServicePlan" action="${formAction}" method="post">
            <c:if test="${status == 'success'}"> <font color="green">Service Plan updated successfully!</font><br/>
            </c:if>
            <c:if test="${status == 'error'}"> <font color="red">An error has occurred while updating the Service Plan: ${errorMessage}!</font><br/>
            </c:if>
            <table border="0">
                <tr>
                    <td width="169">Service Plan </td>
                    <td width="144">
                        <select name="servicePlans" id="servicePlans">
                            <%
                                java.util.List<entity.ServicePlan> servicePlans = (java.util.List<entity.ServicePlan>) request.getAttribute("servicePlans");
                                for (entity.ServicePlan svcPlan : servicePlans) {
                            %>
                            <option value="<%=svcPlan.getSvcPlanName()%>" <%=(request.getParameter("servicePlan") != null) ? ((request.getParameter("servicePlan").equals(svcPlan.getSvcPlanID().toString())) ? ("selected") : ("")) : ("")%>><%=svcPlan.getSvcPlanName()%></option>
                            <%
                                }
                            %>
                        </select></td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td>Plan Name: </td>
                    <td><input type="text" name="eventName" id="eventName" value="<%=(request.getParameter("eventName") != null) ? (request.getParameter("eventName")) : ("")%>" />
                        <span class="errorMessage" id="lblErrEventName"></span></td>
                </tr>
                <tr>
                    <td>Monthly Subscription: </td>
                    <td><input type="text" name="startDateTime" id="startDateTime" value="<%=(request.getParameter("startDateTime") != null) ? (request.getParameter("startDateTime")) : ("")%>" />
                        <span class="errorMessage" id="lblErrStartDateTime"></span></td>
                </tr>
                <tr>
                    <td>Commission 1 in %</td>
                    <td><input type="text" name="endDateTime" id="endDateTime" value="<%=(request.getParameter("endDateTime") != null) ? (request.getParameter("endDateTime")) : ("")%>" />
                        <span class="errorMessage" id="lblErrEndDateTime"></span></td>
                </tr>
                <tr>
                    <td>Commission 2 in %</td>
                    <td><input type="text" name="endDateTime2" id="endDateTime2" value="<%=(request.getParameter("endDateTime") != null) ? (request.getParameter("endDateTime")) : ("")%>" /></td>
                </tr>
                <tr>
                    <td>Initial Fee:</td>
                    <td><input type="text" name="endDateTime3" id="endDateTime3" value="<%=(request.getParameter("endDateTime") != null) ? (request.getParameter("endDateTime")) : ("")%>" /></td>
                </tr>
                <tr>
                    <td>Per Unit Fee </td>
                    <td><input type="text" name="endDateTime4" id="endDateTime4" value="<%=(request.getParameter("endDateTime") != null) ? (request.getParameter("endDateTime")) : ("")%>" /></td>
                </tr>
                <tr>
                    <td colspan="2"><input type="submit" value="Add Event" />
                        <input type="reset" value="Clear" /></td>
                </tr>
            </table>
        </form>
    </body>
</html>
